<template>
  <div>
    <div v-for="(item, index) in menuList" :key="index">
      <el-submenu
        :index="item.id + ''"
        v-if="item.childMenus && item.childMenus.length > 0"
        :key="item.id + ''"
      >
        <template slot="title" style="padding-left: 30px">
          <i :class="item.icon"></i>
          <span slot="title">{{ item.menuName }}</span>
        </template>
        <MenuTree :menuList="item.childMenus"></MenuTree>
      </el-submenu>
      <el-menu-item
        v-else
        :index="item.routerUrl + ''"
        :route="item.routerUrl"
        :key="item.id + ''"
        style="padding-left: 50px"
      >
        <i :class="item.icon"></i>
        <span>{{ item.menuName }}</span>
      </el-menu-item>
    </div>
  </div>
</template>
<style>
.el-menu--collapse span,
.el-menu--collapse i.el-submenu__icon-arrow {
  height: 0;
  width: 0;
  overflow: hidden;
  visibility: hidden;
  display: inline-block;
}
</style>
<script>
export default {
  name: "MenuTree", //模板名称
  props: {
    menuList: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  components: {},
  data() {
    return {};
  },
  created() {},
  mounted() {},
  methods: {},
};
</script>